#ifndef i2c_h
#define i2c_h

#include "gpio.h"

#define SDA       GPIO_PIN_7
#define SCL       GPIO_PIN_6
#define ReadSDA() HAL_GPIO_ReadPin(GPIOB, SDA)
#define I2C_PORT  GPIOB
//从机地址
#define AHT20_ADDRESS 0x38
#define OLED_ADDRESS 0x3D

// void I2C_GPIO_Init(void);
void SCL_OD(void);
void SDA_PP(void);
void SDA_IN(void);
void i2c_start(void);
void i2c_stop(void);
void i2c_ack(void);
void i2c_nack(void);
void i2c_write(uint8_t address7, uint8_t *data, uint8_t len);
uint8_t i2c_read(uint8_t address7, uint8_t *data, uint8_t len);
uint8_t sendbyte(uint8_t data);
uint8_t readbyte(uint8_t ack);

#endif